
var NenmoCoin = artifacts.require("./NenmoCoin.sol");
// import getWeb3 from './utils/getWeb3';

contract('NenmoCoin', function (accounts) {
  let nenmoCoin;
  it("检查初始化后，合约的创建者拥有所有的币！", function () {
    return NenmoCoin.deployed().then(instance=> {
      nenmoCoin = instance;
      // console.log('nenmoCoin',nenmoCoin);
      // let initCoinAmount = web3.eth.getBalance(accounts[0]).toNumber();
      return nenmoCoin.balanceOf(accounts[0]);
      // console.log('total',total);
      // assert.equal(21000000,total,'owner balance equals the totalsupply!');
      // return nenmoCoin.totalSupply.call();
      
    }).then(account0Balance=>{
      console.log('totalSupploy',account0Balance.toNumber());
      assert.equal(account0Balance,210000,'项目发起者拥有所有的币！');
      return web3.eth.getBalance(accounts[0]);
    }).then(res=>{
      console.log('res',res.toNumber());
      return nenmoCoin.transfer(accounts[1],100);
    }).then(()=>{
      return nenmoCoin.balanceOf(accounts[1]);
    }).then(amountOfAccount=>{
      console.log('amountOfAccount',amountOfAccount.toNumber());
      // console.log('web3.eth.getBalance(accounts[1])',web3.eth.getBalance(accounts[1]).toNumber());
    });
  });
});
